<script>
  import { page } from '$app/stores';
  import ActiveChannel from '$lib/components/ActiveChannel.svelte';
  import MessageInput from '$lib/components/MessageInput.svelte';
  import { messages } from '$lib/store';

  let channel = $derived($page.params.channel);
  let messageRuns = $derived($messages.inChannel(channel));
</script>

<div class="active-channel">
  <ActiveChannel {messageRuns} />
</div>
<div class="create-message max-h-full">
  <MessageInput {channel} />
</div>

<style>
  .active-channel {
    height: calc(
      100vh - var(--app-bar-height) - var(--interface-padding) - var(--input-row-height)
    );
    overflow: auto;
  }
  .create-message {
    position: fixed;
    bottom: 0.5rem;
    width: calc(100% - var(--nav-width) - 2rem);
    @media (width <= 640px) {
      width: 100%;
      left: 0;
    }
  }
</style>
